home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Programming / tek / msg / replymsg.c < prev    next >
C/C++ Source or Header  |  2001-05-12  |  610b  |  41 lines

  1.  
  2. #include "tek/msg.h"
  3. #include "tek/kn/exec.h"
  4. #include "tek/debug.h"
  5.  
  6. /* 
  7. **    TEKlib
  8. **    (C) 2001 TEK neoscientists
  9. **    all rights reserved.
  10. **
  11. **    TVOID TReplyMsg(TAPTR msg)
  12. **
  13. **    reply a message.
  14. **
  15. */
  16.  
  17. TVOID TReplyMsg(TAPTR mem)
  18. {
  19.     if (mem)
  20.     {
  21.         TMSG *msg = ((TMSG *) mem) - 1;
  22.         TPORT *replyport = msg->replyport;
  23.  
  24.         if (replyport)
  25.         {
  26.             msg->status = TMSG_STATUS_REPLIED | TMSG_STATUS_PENDING;
  27.  
  28.             kn_lock(&replyport->lock);
  29.  
  30.             TAddTail(&replyport->msglist, (TNODE *) msg);
  31.             TSignal(replyport->sigtask, replyport->signal);
  32.  
  33.             kn_unlock(&replyport->lock);
  34.         }
  35.         else
  36.         {
  37.             TMMUFreeHandle(msg);
  38.         }
  39.     }
  40. }
  41.